import React, { useState, useEffect, Fragment } from 'react';
import CollectItem, { ICollectItemProps } from './CollectItem';
import './index.less';

export default function MyCollect() {
    const [collectData, setCollectData] = useState<ICollectItemProps[]>([]);

    useEffect(() => {
        setCollectData([
            {
                id: '1',
                title: '默认收藏夹',
                recentUpdateTime: '2021.10.27',
                contentNumber: 2,
            },
            {
                id: '2',
                title: '操作系统',
                recentUpdateTime: '2021.10.27',
                contentNumber: 10,
            },
            {
                id: '3',
                title: '算法',
                recentUpdateTime: '2021.08.27',
                contentNumber: 2,
            },
        ]);
    }, []);

    return (
        <div className="mycollect">
            {collectData.map((item) => {
                return (
                    <Fragment key={item.id}>
                        <CollectItem {...item} />
                    </Fragment>
                );
            })}
        </div>
    );
}
